Merge "SkinFactory: register skins in Setup.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 13 Aug 2014 18:56:53 +0000 (18:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 13 Aug 2014 18:56:53 +0000 (18:56 +0000)
1  2 
includes/Setup.php

diff --combined includes/Setup.php
@@@ -263,8 -263,21 +263,21 @@@ if ( $wgSkipSkin ) 
        $wgSkipSkins[] = $wgSkipSkin;
  }
  
- // Register a hidden "fallback" skin
- $wgValidSkinNames['fallback'] = 'Fallback'; // SkinFallback
+ // Register skins
+ // Use a closure to avoid leaking into global state
+ call_user_func( function() use ( $wgValidSkinNames ) {
+       $factory = SkinFactory::getDefaultInstance();
+       foreach ( $wgValidSkinNames as $name => $skin ) {
+               $factory->register( $name, $skin, function() use ( $skin ) {
+                       $class = "Skin$skin";
+                       return new $class;
+               } );
+       }
+       // Register a hidden "fallback" skin
+       $factory->register( 'fallback', 'Fallback', function() {
+               return new SkinFallback;
+       } );
+ } );
  $wgSkipSkins[] = 'fallback';
  
  if ( $wgLocalInterwiki ) {
@@@ -465,6 -478,23 +478,6 @@@ if ( $wgTmpDirectory === false ) 
        wfProfileOut( $fname . '-tempDir' );
  }
  
 -// $wgHTCPMulticastRouting got renamed to $wgHTCPRouting in MediaWiki 1.22
 -// ensure back compatibility.
 -if ( !$wgHTCPRouting && $wgHTCPMulticastRouting ) {
 -      $wgHTCPRouting = $wgHTCPMulticastRouting;
 -}
 -
 -// Initialize $wgHTCPRouting from backwards-compatible settings that
 -// comes from pre 1.20 version.
 -if ( !$wgHTCPRouting && $wgHTCPMulticastAddress ) {
 -      $wgHTCPRouting = array(
 -              '' => array(
 -                      'host' => $wgHTCPMulticastAddress,
 -                      'port' => $wgHTCPPort,
 -              )
 -      );
 -}
 -
  // Back compatibility for $wgRateLimitLog deprecated with 1.23
  if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
        $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;